package com.jinghang.scala_base._4_Scala隐式转换

import java.io.File

import com.jinghang.scala_base._4_Scala隐式转换.JavaFileToScallaFile.RichFile
import com.jinghang.scala_base._4_Scala隐式转换.MenToSupperMan.{Man, Superman}

object ImplicitAspect {

  implicit val name2:String= "implicit_name"
  implicit val name1:Int = 18
  /**
    * 赋予普通人超人的权限，参数是man,返回值是superMan
    * @param man
    * @return
    */
  implicit def man2superman(man:Man):Superman = {
    new Superman(man.name)
  }

  /**
    * 把scala RichFile 简便用法的功能赋予javaFile
    * @param file
    * @return
    */
  implicit def file2RichFile(file: File): RichFile = {
    new RichFile(file)
  }

}
